package com.zut.demo1.service.impl;

import com.zut.demo1.dao.CtpkMapper;
import com.zut.demo1.model.CtpkExample;
import com.zut.demo1.service.CtpkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.awt.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

@Service
public class CtpkServiceImpl implements CtpkService {
    @Autowired
    CtpkMapper ctpkMapper;



    @Override  //未上课
    public int count_ck1(String times) throws ParseException {

        CtpkExample example = new CtpkExample();
        CtpkExample.Criteria criteria = example.createCriteria();

        criteria.andLessondateLike(times);
        criteria.andSkEqualTo("0");

        return ctpkMapper.countByExample(example);
    }

    @Override  //已经上过课
    public int count_ck2(String times) {
        CtpkExample example = new CtpkExample();
        CtpkExample.Criteria criteria = example.createCriteria();
        criteria.andLessondateLike(times);

        return ctpkMapper.countByExample(example);
    }

    @Override
    public int count_pk1(String times) {
        CtpkExample example = new CtpkExample();
        CtpkExample.Criteria criteria = example.createCriteria();
        criteria.andLessondateLike(times);
        criteria.andPkEqualTo("1");

        return ctpkMapper.countByExample(example);
    }

    @Override
    public int count_pk2(String times) {
        CtpkExample example = new CtpkExample();
        CtpkExample.Criteria criteria = example.createCriteria();
        criteria.andLessondateLike(times);

        return ctpkMapper.countByExample(example);
    }


}
